< previous page page_236 next page >

Page 236
The answer is that animation performance sometimes varies greatly. The tests described in this chapter were run on a relatively fast computer that was not doing much else at the time. On a slower computer or one that was heavily loaded, the programs would not run as quickly.
Even more important, the performance of these programs depends on the size of the images they are displaying. If the images are large, the programs take more memory and must move more memory in and out of the display picture box. Program PlayFile must move more data from the hard disk. All this slows down the programs.
In one test, program PlayWait was able to display more than 285 frames per second when the images were 130 by 130 pixels in size. With 250 by 250 images, the program could display only 140 frames per second. With 800 by 600 pixel images, the program could display only 29 frames per second. Add some other programs running on a slower computer, and the program could have trouble displaying even 12 frames per second. Of course, even at this slow speed, 5 seconds of animation using 24-bit color would take up to more than 84MB of memory, so this program may be impractical in any case.
Table 8.1 shows the number of frames per second displayed by the programs discussed so far. The tests were run on a 133MHz Pentium and used the same 130 by 130 pixel 24-bit color images.
Drawing Animation
Bitmap animation gives you excellent control over the images that are displayed. When you create the frames, you can spend as much time as you like making sure they show exactly what you want. On the other hand, bitmap animation takes a huge amount of memory. Animating even a few seconds for a small image can take several megabytes.
In some applications, you can save a lot of memory by generating the frames as you need them rather than storing them as images ahead of time. This gives a space-versus-time tradeoff that is common in computer programming. Generating images as you need them saves memory, but it may take more time.
Table 8.1 Frames per Second

PROGRAM
FRAMES
PER SECOND

ADVANTAGES

DISADVANTAGES
PlayFast395Very fast. Simple.No speed control.
PlayTmr96Adequate speed
control.
Slower.
PlayWait385Fast. Excellent
speed control.
Somewhat complex.
PlayFile52Less memory required.Slow.
PlayBits266Very fast. Images
in one file.
Very complex.

 
< previous page page_236 next page >